<template>
	<view>
		<view class="" style="padding: 10px 10px;">
			<view class="">
				<text class="myicon icon-lishijilu"></text>
				<text class="uifont" style="font-weight: 700;">最近观看</text>
			</view>
			<view style="margin-top: 8px;width: 100%;">
				<template v-if="favorList.total">
					<scroll-view  scroll-x  style="height: 200px;width: 100%;">
						<view class="justify-start">
							<view class="flex-col" v-for="(item, index) in favorList.data" style="margin: 0 10px;">
								<img @click="nav('/pages/opera/video/play?opera_id='+item.opera_id+'&opera_collection_id='+item.opera_collection_id)" :src="baseURL+'/'+item.opera_info.logo_img" alt="" style="height: 170px;width: 100px;border-radius: 10px;">
								<text style="text-align: center;">{{ item.opera_info.name }}</text>
							</view>
						</view>
					</scroll-view>
				</template>
				<view v-else>
					<Empty classname="empty_class"></Empty>
				</view>
			</view>
			<view class="" style="margin-top: 15px;">
				<text class="myicon icon-lishijilu"></text>
				<text class="uifont" style="font-weight: 700;">热门新剧</text>
			</view>
			<view style="margin-top: 8px;">
				<view class="item justify-between"  v-for="(item, index) in operaList.data" :key="index">
					<view style="">
						<img :src="baseURL+'/'+item.logo_img" alt="" style="height: 170px;width: 100px;border-radius: 10px;">
					</view>
					<view style="margin-left: 10px;flex-grow: 1;" class="justify-between flex-col">
						<view style="margin-top: 40px;font-weight: 700;">{{ item.name }}</view>
						<view class="align-end justify-between" style="width: 100%;">
							<view style="font-size: 12px;flex-shrink: 0;">更新至{{ item.collection_count }}集</view>
							<view @click="nav('/pages/opera/video/play?opera_id='+item.opera_id)" class="border-color text-color" style="padding: 10px 30px;border-radius: 10px;text-align: center;">立即播放</view>
						</view>
					</view>
				</view>
			</view>
			
		</view>
		
		
		<view :style="{height:`${constant.bottom_bar_height}px`}">
			<BottomBar v-model='barIndex' :barlists="barlists"/>
		</view>
	</view>
</template>

<script>
	import config from '@/pages/opera/config.js'
	export default {
		data() {
			return {
				baseURL:this.baseURL,
				barIndex:2,
				constant:this.constant,
				barlists:config.barlists,
				favorList: null,
				user_id:uni.getStorageSync('user_id'),
				operaList: null
			}
		},
		onLoad() {
			this.get('crud/list', {table:'operalog', join_table: 'opera'}).then(({code,paginate})=>{
				if(code==1){
					this.favorList = paginate;
				}
			});
			this.get('opera/index', {limit: 20}).then(({code,paginate})=>{
				if(code==1){
					this.operaList = paginate;
				}
			});
		},
		onShareAppMessage(res) {
			let path = '/pages/index/index?share_id='+this.user_id
			console.log('path',path)
			return {
			  title: '邀请您观看各种好剧！',
			  path,
			}
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
.empty_class{
	.tag_1{
		margin-top: 0 !important;
	}
	.tag_2{
		font-size: 60px !important;
	}
	.tag_3{
		font-size: 12px !important;
	}
}
</style>
